export class FileUtils {
    static getFileNameFromUrl(url):string | null {
        return url.substring(url.lastIndexOf('/') + 1);
    }

    static getOfficeType =(url)=> {
        let arr = FileUtils.getFileNameFromUrl(url)?.split('.');
        if (arr.length != 2) {
            return 'other'
        }
        let type = arr[1]
        if (type == 'doc' || type == 'docx') {
            return 'word'
        } else if (type == 'xls' || type == 'xlsx') {
            return 'excel'
        } else if (type == 'ppt') {
            return 'ppt'
        } else if (type == 'pdf') {
            return 'pdf'
        }
        return 'other'

    }


}
